<template>
	<view class="page-content">
		<u-navbar title="订单支付" :autoBack="true" :bgColor="theme_color" :titleStyle="{color:'#ffffff'}"
			leftIconColor="#ffffff"></u-navbar>
		<view class="goods-box" :style="'margin-top:' + navH + 'px;'">
			<view class="address-box" @click="address_show = true">
				<view class="address-info acea-row row-between-wrapper" v-if="address.province_name!=undefined">
					<view>
						<view class="addr-info-pcd">{{address.province_name || ''}} {{address.city_name || ''}}
							{{address.district_name || ''}}
						</view>
						<view class="addr-info-detail">{{address.address || ''}}</view>
						<view class="addr-info-connect">
							<text class="addr-info-connect-name">{{address.consignee || ''}}</text>
							{{' '+address.mobile || ''}}
						</view>
					</view>
					<view class="arrow-right-icon">
						<view class='iconfont icon-jiantou'></view>
					</view>
				</view>
				<view class="address-info acea-row row-between-wrapper" v-if="address.province_name==undefined">
					<text>设置收货地址</text>
					<view class="arrow-right-icon">
						<view class='iconfont icon-jiantou'></view>
					</view>
				</view>
				<view class='line'>
					<image :src="ima_url+'/statics/yilangmp/line.jpg'"></image>
				</view>
			</view>
			<!-- 要结算的商品列表 - 以店铺为单位 -->
			<view class="store-goods bg-white" v-for="(value,i) in goods_list" :key="i">
				<view class="store-info">
					<image class="store-info-logo"
						:src="ima_url+'/static/Applets/static/images/homepage_icon_dianpu.png' " mode=""></image>
					<text class="store-info-name">{{value.supplier_name}}</text>
				</view>
				<!-- 商品列表 -->
				<view class="store-goods-list" v-for="(item,index) in value.goods_list_1" :key="index"
					@click="goodsDetails(value.goods_id)" v-if="value.goods_list_1!=undefined">
					<image class="sto-goo-li-cover" :src="item.goods_img" mode="aspectFill"></image>
					<view class="sto-goo-li-info">
						<view class="sto-goo-li-info-top">
							<text class="sto-goo-li-info-name">{{item.goods_name}}</text>
							<view class="sto-goo-li-info-price">
								<text class="sto-goo-li-info-shop-price">¥{{item.shop_price | priceFixed}}</text>
								<text class="sto-goo-li-info-market-price">¥{{item.market_price | priceFixed}}</text>
							</view>
						</view>
						<view class="sto-goo-li-info-center">
							<text class="sto-goo-li-info-attr">规格：{{item.goods_attr || '无'}}</text>
							<text class="sto-goo-li-info-number">x{{item.goods_number}}{{item.unit}}</text>
						</view>
					</view>
				</view>
				<view class="store-goods-list" @click="goodsDetails(value.goods_id)"
					v-if="value.goods_list_1==undefined">
					<image class="sto-goo-li-cover" :src="value.goods_img" mode="aspectFill"></image>
					<view class="sto-goo-li-info">
						<view class="sto-goo-li-info-top">
							<text class="sto-goo-li-info-name">{{value.goods_name}}</text>
							<view class="sto-goo-li-info-price">
								<text class="sto-goo-li-info-shop-price">¥{{value.shop_price | priceFixed}}</text>
								<text class="sto-goo-li-info-market-price">¥{{value.market_price | priceFixed}}</text>
							</view>

						</view>
						<view class="sto-goo-li-info-center">
							<text class="sto-goo-li-info-attr">规格：{{value.goods_attr || '无'}}</text>
							<text class="sto-goo-li-info-number">x{{value.goods_number}}{{value.unit}}</text>
						</view>
					</view>
				</view>
				<!-- 配送方式 -->
				<view class="store-goods-item" @click="goods_index = i;  showPopup('ps')">
					<text class="sto-goo-item-name">配送方式</text>
					<view class="sto-goo-item-content">
						<text>{{ deliveryMethodText || '商家自定配送'}}</text>
						<text>{{best_time || '商家自定配送时间'}}</text>
					</view>
					<view class="arrow-right-icon">
						<u-icon name="arrow-right" color="#ADADAD" size="20"></u-icon>
					</view>
				</view>
				<!-- 订单备注 -->
				<view class="store-goods-item" @click="goods_index = i; showPopup('bz')">
					<text class="sto-goo-item-name">订单备注</text>
					<view class="sto-goo-item-content">
						<text :class="{'content-null':!goods_list[goods_index].postscript}">
							{{goods_list[goods_index].postscript || '无备注'}}
						</text>
					</view>
					<view class="arrow-right-icon">
						<u-icon name="arrow-right" color="#ADADAD" size="20"></u-icon>
					</view>
				</view>
			</view>
			<view class="red-envelope" @click="bonusSelect()">
				<image class="red-envelope-icon" :src="ima_url+'/static/Applets/static/images/store_hb.png' " mode="">
				</image>
				<text class="red-envelope-text">可用红包</text>
				<view class="arrow-right-icon acea-row">
					<view style="margin-right: 10px;">-￥{{bonus_price}}</view>
					<u-icon name="arrow-right" color="#ADADAD" size="20"></u-icon>
				</view>
			</view>
			<!-- 支付方式 -->
			<view class="pay-type">
				<view class="title">
					支付方式
				</view>
				<view class="radio-box">
					<!-- <radio-group @change="payRadioChange">
						<view class="radio-item" v-for="(item,index) in pay_list" :key="index">
							<view>
								<radio :value="item.pay_type" :checked="index === payRadioCurrent" />
							</view>
							<view>{{item.pay_name}}</view>
						</view>
					</radio-group> -->
					<view class="radio-item">
						<u-radio-group>
							<u-radio activeColor="green" shape="circle" label="微信"></u-radio>
						</u-radio-group>
					</view>

				</view>
			</view>
			<view class="s-time-box-2 bg-white acea-row row-between-wrapper" style="margin-top: 30rpx;">
				<view style="">小计</view>
				<view>￥{{total_price_2 | priceFixed}}</view>
			</view>
		</view>

		<view class='footer acea-row row-between-wrapper'>
			<view>合计:
				<text class='fw-bolder'
					style="color: orangered;font-size: 18px;">￥{{total_price || 0 | priceFixed}}</text>
			</view>
			<view class='settlement' style='z-index:100' @click="submitOrder()">立即支付</view>
		</view>

		<!-- 选择地址模块 -->
		<u-popup :show="address_show" :closeable="true" :safeAreaInsetTop="true" :round="8"
			@close="address_show = false,address_index = 0">
			<view class="select-address">
				<view class="address-item">
					<scroll-view scroll-y="true" style="height: 800rpx;">
						<view class="item-box">
							<view class="ad-txt" @click="addAddress()">添加地址</view>
							<radio-group>
								<view v-for="(value,i) in address_list" :key="i">
									<view class="acea-row row-middle"
										style="margin-bottom: 10px;padding-bottom: 10px;border-bottom: 1px solid #dddddd;">
										<radio @click="radioSelectAddress(value,i)"
											:checked="address.address_id == value.address_id " />
										<view style="padding-left: 10px;" class="fs-12">
											<view class="fw-bolder">
												{{value.consignee}}
											</view>
											<view style="padding: 10px 0;">
												{{value.mobile}}
											</view>
											<view>
												{{value.province_name}} {{value.city_name}} {{value.district_name}}
												{{value.address}}
											</view>
										</view>

									</view>
								</view>
							</radio-group>
						</view>
					</scroll-view>
					<view class="acea-row row-around">
						<view @click="addressCancel()">取消</view>
						<view @click="addressConfirm()">确定</view>
					</view>
				</view>
			</view>
		</u-popup>

		<!-- 红包	 -->
		<u-popup :show="bonus_isShow" @close="backRed()" mode="bottom" :closeable="true">
			<view class="red-content-box">
				<scroll-view scroll-y="true" v-bind:style="{'height': scroll_Height_4 }" v-if="bonus_list.length > 0">
					<view class="list_box">
						<radio-group>
							<view v-for="(value,i) in bonus_list" :key="i">
								<view class="radio-box">
									<radio @click="selectRed(i)"
										:checked="min_goods_amount<total_price_3  && bonus_index == i  " />
								</view>
								<view class="red-box">
									<view class="red-list">
										<view class="img-bg">
											<!-- 未使用   used_text  2已使用3已失效4可使用 -->
											<image v-if="value.used_text == '可使用' "
												:src="ima_url+'/static/Applets/static/huawei/Wallet/qbhb2.png' "
												class="img" mode=""></image>
											<!-- 已使用 -->
											<image v-if="value.used_text == '已使用' " src="@/static/images/ended.png"
												class="img" mode=""></image>
											<!-- 已失效 -->
											<image v-if="value.used_text == '已失效' "
												:src="ima_url+'/static/Applets/static/huawei/Wallet/qbhb1.png' "
												class="img" mode=""></image>
											<view v-for="(value2,j) in value.bonus_list" :key="j">
												<view class="red-content">
													<view class="left" :class="{'left2':value.used_text != '可使用'} ">
														<view class="money">
															<text class="txt">
																{{value2.type_money}}
															</text>元
														</view>
														<view class="title-m">
															活动红包
														</view>
													</view>
													<view class="right">
														<view class="store-name"
															:class="{'store-name2':value.used_text != '可使用'}">
															<text class="txt">{{value.supplier_name}}</text>
														</view>
														<view class="min-money">
															<text class="txt">使用最低金额：</text>
															{{value2.min_goods_amount}}
														</view>
														<view class="time-box">
															<text class="txt">有效日期：</text>
															{{value2.use_start_date}}
															-
															{{value2.use_end_date}}
														</view>
													</view>
												</view>
											</view>
										</view>
									</view>
								</view>
							</view>
						</radio-group>
					</view>
				</scroll-view>
				<view class="massage" v-else>
					<u-empty mode="coupon" icon="http://cdn.uviewui.com/uview/empty/coupon.png" text="没有可用红包">
					</u-empty>
				</view>
			</view>
		</u-popup>


		<!-- 弹出层 - 选配送方式、时间/订单备注 -->
		<u-popup :show="popupShow" @close="popupClose" :round="8" closeable safeAreaInsetBottom closeOnClickOverlay>
			<view>
				<!-- 配送服务 -->
				<view class="popup-content" v-if="popupType == 'ps'">
					<text class="popup-content-title">配送服务</text>

					<view class="popup-content-item">
						<text class="pop-con-item-title">配送方式</text>
						<view>
							<view class="acea-row">
								<view class="padding10">
									<checkbox-group @change="merchantCustomized">
										<label>
											<checkbox value="商家自定" :checked="merchant_isShow" />商家自定
										</label>
									</checkbox-group>
								</view>
								<view class="padding10">
									<checkbox-group @change="optionalDelivery">
										<label>
											<checkbox value="自选配送方式" :checked="optional_isShow" />用户自选
										</label>
									</checkbox-group>
								</view>
							</view>
							<view style="padding: 15rpx 0;" v-if="optional_isShow">
								（<text style="color: orangered; font-size:26rpx;">自选没选到具体物流，提交订单后默认商家自定</text> ）
							</view>
							<!-- 配送方式列表 -->
							<view class="acea-row padding10" v-if="optional_isShow">
								<view v-if="goods_list[goods_index].shipping_type.length != 0"
									v-for="(value_3,k) in goods_list[goods_index].shipping_type" :key="k">
									<text
										style="padding: 15rpx 20rpx; border: 2rpx solid #dddddd; line-height: 1;margin-left: 10px;"
										:style="{
														'background-color': value_3.isShow ? '#CC0518' : '',
														'color': value_3.isShow ? '#ffffff' : ''
														}" @click="payChang(k)">
										{{value_3.name}}
									</text>
								</view>
							</view>
							<!-- 配送方式列表 pay_isShow  -->
							<view
								v-if="optional_isShow&&goods_list[goods_index].pay_isShow&&goods_list[goods_index].shipping_type.length != 0 "
								class="" style="padding-top: 30rpx;border: none;">
								<scroll-view scroll-y="true" show-scrollbar="true"
									v-bind:style="{'max-height': 200+'px' }" @scrolltolower="LoadingMorePickedUpList">
									<view style="width: 100%;">
										<view
											v-for="(value_4,index) in goods_list[goods_index].shipping_type[goods_list[goods_index].index_shipping_type].shipping_list"
											:key="index">
											<view class="padding10" style="display: flex; align-items: center;"
												@click="payShipping(index)">
												<view style="display: flex; align-items: center;">
													<image v-if="!value_4.isShow"
														style="width: 40rpx; height: 40rpx; margin-right:10rpx;vertical-align: middle;"
														:src="ima_url+'/static/Applets/static/images/no_goods_select.png' "
														mode=""></image>
													<!-- 选中按钮 -->
													<image v-if="value_4.isShow"
														style="width: 40rpx; height: 40rpx;margin-right:10rpx;vertical-align: middle;"
														:src="ima_url+'/static/Applets/static/images/goods_select.png' "
														mode=""></image>
												</view>
												<text class="txt-2">{{value_4.shipping_name}}
													<text style="font-size: 24rpx;color: darkred;"
														v-if="value_4.juli != ''">{{value_4.juli|juliFilters}}</text>
												</text>
											</view>
										</view>
									</view>
								</scroll-view>
							</view>
						</view>
					</view>
					<view class="popup-content-item">
						<text class="pop-con-item-title">配送时间</text>
						<view class="acea-row">
							<view class="padding10">
								<checkbox-group @change="merchantCustomizedTime">
									<label>
										<checkbox value="商家自定" :checked="best_time_isShow_1" />商家自定
									</label>
								</checkbox-group>
							</view>
							<view class="padding10">
								<checkbox-group @change="optionalDeliveryTime">
									<label>
										<checkbox value="自选配送时间" :checked="best_time_isShow_2" />用户自选
									</label>
								</checkbox-group>
							</view>

						</view>
						<view style="width: 100%;" v-if="best_time_isShow_2">
							<radio-group @change="dataRadioChange">
								<view class="">
									<label for="">
										<radio value="工作日/周末/节假日均可" style="transform: scale(0.8);" />
										<text class="txt-2">工作日/周末/节假日均可</text>
									</label>
								</view>
								<view class="">
									<label for="">
										<radio value="仅工作日送货" style="transform: scale(0.8);" />
										<text class="txt-2">仅工作日送货</text>
									</label>
								</view>
								<view class="">
									<label for="">
										<radio value="仅周末送货" style="transform: scale(0.8);" />
										<text class="txt-2">仅周末送货</text>
									</label>
								</view>
								<view class="">
									<label for="">
										<radio value="指定送货时间" style="transform: scale(0.8);" />
										<text class="txt-2">指定送货时间</text>
									</label>
								</view>
							</radio-group>
						</view>
					</view>
					<view class="popup-content-hint">
						送货时间仅供参考，快递员会尽量满足你的要求
					</view>
				</view>
				<!-- 订单备注 -->
				<view class="popup-content" v-if="popupType == 'bz'">
					<text class="popup-content-title">订单备注</text>
					<textarea class="popup-content-textarea" placeholder="请输入你要备注的内容" maxlength="-1"
						placeholder-style="font-size:28rpx ;" v-model="goods_list[goods_index].postscript"
						@input="inputPostscript">
								</textarea>
					<view class="popup-content-confirm" @click="popupShow = false">
						确定
					</view>
				</view>
			</view>
		</u-popup>

	</view>
</template>

<script>
	import {
		BASE_URL
	} from '@/config/app'
	import {
		buy_now_batch,
		buy_now,
		picked_up_list,
		get_order_bonus_now,
		pay_list,
		bank_list,
		sub_order_now,
		sub_order_now_bath,
		third_epay_submit,
		get_pay_code,
		epay_submit,
		distributes_sub_order_now
	} from '@/api/store'
	import {
		address_edit_add,
		address_list,
		address_del,
		get_regions
	} from '@/api/user'
	import {
		mapGetters
	} from "vuex";
	export default {
		filters: {
			juliFilters(val) {
				if (val < 1000 && val != null) {
					return '(' + parseFloat(val).toFixed(2) + 'Km)'
				} else if (val >= 1000) {
					return '(' + parseFloat(val / 1000).toFixed(2) + 'Km)'
				} else if (val == null) {
					return ''
				}
			},
			priceFixed(val) {
				return Number(val).toFixed(2)
			}
		},
		data() {
			return {
				navH: '',
				theme_color: getApp().globalData.theme_color,
				ima_url: BASE_URL,
				address_list: [],
				address: {}, //存放默认地址
				address_id: '',
				address_show: false,
				address_index: 0,
				scroll_Height: '',
				scroll_Height_4: '',
				popupShow: false, //弹出层显示状态
				popupType: '', //弹出层显示的类型 - ps 配送 bz 订单备注
				goods_list: [],
				rec_id: '', //购物id
				total_price: '',
				total_price_2: 0.00, //存放原始的价格
				total_price_3: 0.00, //存放原始的价格
				pay_index: 0,
				pay_index_2: 0,
				pay_shipping_id: '',
				pay_isShow: false,
				goods_index: 0,
				order_index: 0,
				checked_p1: false,
				checked_p2: false,
				checked_p3: false,

				merchant_isShow: false, //商家自订
				optional_isShow: true, //客户自选
				shipping_type_id: '', //用来存放选中的配送点id

				shipping_type: '',

				state_list: [],
				state_list_name: [],
				state_list_name_count: 0,
				state_id: '-1',
				// 省
				province_list: [],
				province_list_name: [],
				province_list_name_count: 0,
				province_id: '-1',
				// 市
				city_list: [],
				city_list_name: [],
				city_list_name_count: 0,
				city_id: '-1',
				// 区
				area_list: [],
				area_list_name: [],
				area_list_name_count: 0,
				area_id: '-1',


				// 支付方式
				pay_isShow: false,
				pay_type: 7, //支付方式
				pay_id: '',
				pay_name: '商家微信',
				is_pay_show: true,
				pay_list: [], //获取店铺可支付方式(微信，支付宝)
				payRadioCurrent: 0,

				alipay_isShow: false,
				weixin_isShow: false,

				supplier_id: '', //店铺id
				bank_list: [], //银行账号
				bank_list_isShow: false,
				bank_index: 0,

				goods_id: '',
				product_sn: '',
				goods_number: '',
				goods_atrr_img: '',


				// 订单可用红包列表
				bonus_list: [], //红包列表
				bonus_price: '0.00', // 存放选中的红包价格
				bonus_id: '', //红包id
				bonus_isShow: false,
				bonus_index: 0,
				min_goods_amount: 0,


				best_time: '', //配送时间
				best_time_isShow_1: true, //配送时间(商家自定)
				best_time_isShow_2: false, //配送时间(自选)

				select_input_box: 'width:100%;height:60rpx;background-color:#fff;',
				select_input_box_input_content: '',
				select_input_box_input_content_2: '',
				select_input_box_input_content_3: '',
				select_input_box_input_content_4: '',
				select_input_box_input_content_index: 0,
				select_input_box_input_content_2_index: 0,
				select_input_box_input_content_3_index: 0,
				select_input_box_input_content_4_index: 0,


				isSubmit: 0,
				product_list: '', //货品id_购买数量_单位_单位换算率 逗号拼接

				is_use_cash: null,
				deliveryMethodText: '', //配送方式展示文本
				latitude: '',
				longitude: '',
				PickedUpListPage: 1,
				pickup_point: [],
				
				is_fx:0,
				uos_id:0
			}
		},
		computed: mapGetters(["isLogin", "app_token"]),
		async onLoad(e) {
			var _this = this;
			_this.navH = getApp().globalData.navHeight / 2 - 5;
			var Height = parseFloat(getApp().globalData.screenHidth) * 0.92 * 2 + 'upx';
			this.scroll_Height = Height.toString();

			this.scroll_Height_4 = parseFloat(getApp().globalData.screenHidth) * 1 * 2 + 'rpx'

			this.product_list = e.product_list

			if (e.goods_id == null) {
				uni.showModal({
					content: '返回上一页选择要购买的商品再进来',
					showCancel: false
				})
			} else {

				this.goods_id = e.goods_id;
				this.product_sn = e.product_sn;
				this.goods_number = e.goods_number;
				this.is_fx = parseInt(e.is_fx)
				this.uos_id = parseInt(e.uos_id) || 0

				if (e.product_list != undefined) {
					await buy_now_batch({
						app_token: this.app_token,
						goods_id: e.goods_id, //商品id
						product_list: e.product_list,
					}).then(async (res2) => {
						var data_string = res2;
						_this.total_price = data_string.data.total_price;
						_this.total_price_2 = data_string.data.total_price;
						_this.total_price_3 = parseInt(data_string.data.total_price);
						// 只有一个店铺的商品,所以默认给店铺地址
						this.supplier_id = data_string.data.supplier_id;
						_this.getPayType(data_string.data.supplier_id);
						if (e.product_list != undefined) {

							var obj = {
								supplier_name: data_string.data.supplier_name,
								shipping_type: [],
								shipping_type_id: '', //用来存放选中的配送点id
								shipping_type_isNull: false,
								goods_id: data_string.data.goods_id,
								goods_list_1: [],
								total_price: data_string.data.total_price,
								best_time: '', //配送时间
								postscript: '', //订单备注
								index_shipping_type: 0, //记录选中的那种配送方式
								pay_isShow: false, //是否显示配送方式的配送点
								is_use_cash: data_string.data.is_use_cash
							};
							if (data_string.data.goods_list.length != 0) {
								for (let value of data_string.data.goods_list) {
									let list = {
										goods_attr: value.goods_attr,
										goods_attr_id: value.goods_attr_id,
										goods_img: value.goods_img,
										goods_name: value.goods_name,
										goods_number: value.goods_number,
										market_price: value.market_price,
										product_id: value.product_id,
										shop_price: value.shop_price,
										unit: value.unit,
									}
									obj.goods_list_1.push(list)
								}
							}
						} else {
							var obj = {
								supplier_name: data_string.data.supplier_name,
								shipping_type: [],
								shipping_type_id: '', //用来存放选中的配送点id
								shipping_type_isNull: false,
								goods_name: data_string.data.goods_name,
								shop_price: data_string.data.shop_price,
								market_price: data_string.data.market_price,
								unit: data_string.data.unit,
								goods_attr: data_string.data.goods_attr,
								goods_number: data_string.data.goods_number,
								total_price: data_string.data.total_price,
								best_time: '', //配送时间
								postscript: '', //订单备注
								index_shipping_type: 0, //记录选中的那种配送方式
								pay_isShow: false, //是否显示配送方式的配送点
								goods_img: data_string.data.goods_img,
								is_use_cash: data_string.data.is_use_cash,
								goods_id: data_string.data.goods_id
							};
						}
						if (data_string.data.shipping_type.length != 0) {
							for (let item of data_string.data.shipping_type) {
								let obj_2 = {
									id: item.id,
									name: item.name,
									configure: item.configure,
									shipping_list: [],
									isShow: false,
									index_shipping_list: 0,
								}
								for (let item_2 of item.shipping_list) {
									let obj_3 = {
										shipping_id: item_2.shipping_id,
										shipping_name: item_2.shipping_name,
										shipping_desc: item_2.shipping_desc,
										shipping_type: item_2.shipping_type,
										isShow: false, //用来判断是否选中
										juli: item_2.juli
									}
									obj_2.shipping_list.push(obj_3);
								}
								obj.shipping_type.push(obj_2);
							}
						} else {
							obj.shipping_type_isNull = true;
							_this.total_price = _this.total_price;
							_this.total_price_2 = data_string.data.total_price;
							_this.total_price_3 = parseInt(data_string.data.total_price);
						}
						_this.goods_list.push(obj);
						_this.goods_list[_this.goods_index].shipping_type[0].isShow = true

						this.is_use_cash = _this.goods_list[0].is_use_cash

					})
				} else {
					await buy_now({
						app_token: this.app_token,
						product_id: this.product_sn, //商品id
						goods_number: this.goods_number,
						goods_id: e.goods_id,
					}).then(async (res2) => {
						console.log(res2)
						var data_string = res2;
						_this.total_price = data_string.data.total_price;
						_this.total_price_2 = data_string.data.total_price;
						_this.total_price_3 = parseInt(data_string.data.total_price);

						// 只有一个店铺的商品,所以默认给店铺地址
						this.supplier_id = data_string.data.supplier_id;
						_this.getPayType(data_string.data.supplier_id);

						if (e.product_list != undefined) {

							var obj = {
								supplier_name: data_string.data.supplier_name,
								shipping_type: [],
								shipping_type_id: '', //用来存放选中的配送点id
								shipping_type_isNull: false,
								goods_id: data_string.data.goods_id,
								goods_list_1: [],
								total_price: data_string.data.total_price,
								best_time: '', //配送时间
								postscript: '', //订单备注
								index_shipping_type: 0, //记录选中的那种配送方式
								pay_isShow: false, //是否显示配送方式的配送点
								is_use_cash: data_string.data.is_use_cash

							};

							if (data_string.data.goods_list.length != 0) {
								for (let value of data_string.data.goods_list) {
									let list = {
										goods_attr: value.goods_attr,
										goods_attr_id: value.goods_attr_id,
										goods_img: value.goods_img,
										goods_name: value.goods_name,
										goods_number: value.goods_number,
										market_price: value.market_price,
										product_id: value.product_id,
										shop_price: value.shop_price,
										unit: value.unit,
									}
									obj.goods_list_1.push(list)
								}
							}
						} else {
							var obj = {
								supplier_name: data_string.data.supplier_name,
								shipping_type: [],
								shipping_type_id: '', //用来存放选中的配送点id
								shipping_type_isNull: false,
								goods_name: data_string.data.goods_name,
								shop_price: data_string.data.shop_price,
								market_price: data_string.data.market_price,
								unit: data_string.data.unit,
								goods_attr: data_string.data.goods_attr,
								goods_number: data_string.data.goods_number,
								total_price: data_string.data.total_price,
								best_time: '', //配送时间
								postscript: '', //订单备注
								index_shipping_type: 0, //记录选中的那种配送方式
								pay_isShow: false, //是否显示配送方式的配送点
								goods_img: data_string.data.goods_img,
								is_use_cash: data_string.data.is_use_cash,
								goods_id: data_string.data.goods_id
							};
						}
						if (data_string.data.shipping_type.length != 0) {
							for (let item of data_string.data.shipping_type) {
								let obj_2 = {
									id: item.id,
									name: item.name,
									configure: item.configure,
									shipping_list: [],
									isShow: false,
									index_shipping_list: 0,
								}
								for (let item_2 of item.shipping_list) {
									let obj_3 = {
										shipping_id: item_2.shipping_id,
										shipping_name: item_2.shipping_name,
										shipping_desc: item_2.shipping_desc,
										shipping_type: item_2.shipping_type,
										isShow: false, //用来判断是否选中
										juli: item_2.juli
									}
									obj_2.shipping_list.push(obj_3);
								}
								obj.shipping_type.push(obj_2);
							}
						} else {
							obj.shipping_type_isNull = true;
							_this.total_price = _this.total_price;
							_this.total_price_2 = data_string.data.total_price;
							_this.total_price_3 = parseInt(data_string.data.total_price);
						}
						_this.goods_list.push(obj);
						_this.goods_list[_this.goods_index].shipping_type[0].isShow = true
						this.is_use_cash = _this.goods_list[0].is_use_cash
					})
				}

				this.get_bonus_list()

				await this.getPickedUpList()

				this.payChang(0)

				this.payShipping(0)

			}
		},
		async onShow() {
			const addressRes = await this.getAddressList()
			this.setDefaultAddress(addressRes.data)
		},
		methods: {
			radioSelectAddress(item, index) {
				this.address_index = index;
			},
			// 确定地址选择
			addressConfirm: function() {
				this.address = this.address_list[this.address_index];
				this.address_id = this.address_list[this.address_index].address_id;
				this.address_show = false;
			},
			get_bonus_list() {
				var _this = this;
				// 获取红包			
				get_order_bonus_now({
					app_token: this.app_token,
					goods_id: this.goods_id, //商品id
					goods_number: this.goods_number, //购买数量
					product_id: this.product_sn, //货号id
				}).then(res => {
					if (res.data.length > 0) {
						for (let value of res.data) {
							const obj = {
								user_id: value.user_id,
								bonus_type_id: value.bonus_type_id,
								supplier_id: value.supplier_id,
								bonus_id: value.bonus_id, //红包id
								bonus_list: {},
								supplier_name: value.supplier_name,
								used_text: value.used_text,
								isShow: false
							};
							if (value.bonus_list != null) {
								obj.bonus_list = value.bonus_list;
							}
							_this.bonus_list.push(obj);
						}
					}
				})
			},
			/*
			 *显示选择配送方式和时间/订单备注的弹出层
			 * @param {string} type 显示类型 ps 配送方式和时间，bz 订单备注
			 */
			showPopup(type) {
				this.popupShow = true
				this.popupType = type
				if (type == 'ps') {
					this.payChang(0)
					this.payShipping(0)
				} else {

				}
			},

			//关闭弹出层操作
			popupClose() {
				this.popupShow = false
			},

			async LoadingMorePickedUpList() {
				this.PickedUpListPage++;
				const result = await picked_up_list({
					supplier_id: this.supplier_id,
					lat: this.latitude,
					lng: this.longitude,
					page: this.PickedUpListPage
				})
				if (result.status != -2) {
					if (result.status == 1) {
						this.pickup_point = result.data
						for (let item of this.pickup_point) {
							let obj_2 = {
								shipping_id: item.shipping_id,
								shipping_name: item.shipping_name,
								shipping_desc: item.shipping_desc,
								shipping_type: item.shipping_type,
								isShow: false, //用来判断是否选中
								juli: item.juli
							}
							this.goods_list[0].shipping_type[0].shipping_list.push(obj_2);
						}

					}
				}

			},


			//获取店铺自提点列表
			async getPickedUpList() {
				const Location = await this.getLocation();
				this.latitude = Location.latitude
				this.longitude = Location.longitude
				picked_up_list({
					supplier_id: this.supplier_id,
					lat: this.latitude,
					lng: this.longitude,
					page: this.PickedUpListPage
				}).then(res => {
					this.pickup_point = res.data
					let obj_1 = {
						id: 1,
						name: '门店自提',
						configure: '',
						shipping_list: [],
						isShow: false,
						index_shipping_list: 0,
					}
					for (let item of this.pickup_point) {
						let obj_2 = {
							shipping_id: item.shipping_id,
							shipping_name: item.shipping_name,
							shipping_desc: item.shipping_desc,
							shipping_type: item.shipping_type,
							isShow: false, //用来判断是否选中
							juli: item.juli
						}
						obj_1.shipping_list.push(obj_2);
					}
					this.goods_list[0].shipping_type.unshift(obj_1);
				})

			},

			//获取经纬度
			getLocation() {
				return new Promise(resolve => {
					uni.getLocation({
						type: 'wgs84',
						geocode: true,
						success: (res) => {
							resolve(res)
						}
					})
				})
			},

			//获取地址列表
			async getAddressList() {
				const res = await address_list({
					app_token: this.app_token
				})
				let dataClone = res.data;
				dataClone.reverse()
				// 取默认地址的索引值 -1无默认地址
				const defaultIndex = dataClone.findIndex(val => val.is_default === 1)
				if (defaultIndex != -1) {
					const defaultData = dataClone[defaultIndex]
					dataClone.splice(defaultIndex, 1)
					dataClone.unshift(defaultData)
				}
				this.address_list = dataClone;
				this.setDefaultAddress(res.data)
				return res;
			},

			//设置进入订单页默认选中的地址
			setDefaultAddress(data) {
				if (!data.length) {
					this.address = {};
					return false
				}
				let dataClone = data;
				//反转数组
				dataClone.reverse()
				// 取默认地址的索引值 -1无默认地址
				const defaultIndex = dataClone.findIndex(val => val.is_default === 1)
				if (defaultIndex != -1) {
					this.address = dataClone[defaultIndex]
					this.address_id = dataClone[defaultIndex].address_id
				} else {
					// 无默认地址时取列表的第一个地址
					if (dataClone.lenght != 0) {
						this.address = dataClone[0];
						this.address_id = dataClone[0].address_id;
					}
				}
			},

			// 获取店铺可支付方式
			async getPayType(supplier_id) {
				// 判断是否有  店铺可支付方式(微信，支付宝)
				const payRes = await pay_list({
					supplier_id: supplier_id
				})
				this.pay_list = payRes.data; // 获取支付方式
			},

			// 显示红包页面
			bonusSelect: function() {
				this.bonus_isShow = true;
			},

			// 退出红包页面
			backRed: function() {
				this.bonus_isShow = false;
			},

			// 选择红包
			selectRed: function(i) {
				this.bonus_index = i;
				this.bonus_price = '0.00';
				this.bonus_id = '';
				var min_goods_amount = parseInt(this.product_list[i].bonus_list[0].min_goods_amount)
				var total_price = parseInt(this.total_price_2);
				this.min_goods_amount = parseInt(this.product_list[i].bonus_list[0].min_goods_amount);
				if (total_price < min_goods_amount) {
					//待完善代码
				} else {
					this.bonus_price = this.product_list[i].bonus_list[0].type_money
					var price = parseInt(this.total_price_2) - parseInt(this.bonus_price);
					this.total_price = price.toString();
					this.bonus_id = this.product_list[i].bonus_id;
				}
			},

			// 查看商品详情
			goodsDetails: function(goods_id) {
				uni.navigateTo({
					url: '/pages-goods-details/goods_details/goods_details?goods_id=' + goods_id
				})
			},

			// 添加地址
			addAddress: function() {
				uni.navigateTo({
					url: '/pages/users/user_address_list/index'
				})
			},

			// 商家自定配送方式
			merchantCustomized: function(e) {
				this.shipping_type_id = ''
				this.deliveryMethodText = ''
				if (e.detail.value.length != 0) {
					if (e.detail.value[0] == "商家自定") {
						this.merchant_isShow = true; //商家自订
						this.optional_isShow = false; //客户自选
					} else {
						this.merchant_isShow = false; //商家自订
						this.optional_isShow = false; //客户自选
					}
				} else {
					this.merchant_isShow = false; //商家自订
					this.optional_isShow = false; //客户自选
				}
				for (let value_1 of this.goods_list) {
					for (let value of value_1.shipping_type) {
						for (let value_2 of value.shipping_list) {
							value_2.isShow = false;
						}
					}
					for (let value of value_1.shipping_type) {
						value.isShow = false;
					}
				}
				this.shipping_type_id = ''; //用来存放选中的配送点id
			},
			// 自选配送方式 optional merchant
			optionalDelivery: function(e) {
				this.deliveryMethodText = ''
				if (e.detail.value.length != 0) {
					if (e.detail.value[0] == "自选配送方式") {
						this.merchant_isShow = false; //商家自订
						this.optional_isShow = true; //客户自选
					} else {
						this.merchant_isShow = false; //商家自订
						this.optional_isShow = false; //客户自选
					}
				} else {
					this.merchant_isShow = false; //商家自订
					this.optional_isShow = false; //客户自选
				}
				for (let value_1 of this.goods_list) {
					for (let value of value_1.shipping_type) {
						for (let value_2 of value.shipping_list) {
							value_2.isShow = false;
						}
					}
					for (let value of value_1.shipping_type) {
						value.isShow = false;
					}
				}

				this.shipping_type_id = ''; //用来存放选中的配送点id
			},

			// 自选配送方式选择
			// 配送方式选择
			payChang: function(k) {
				this.shipping_type_id = ''
				this.pay_index = k;
				this.deliveryMethodText = ''
				for (let value of this.goods_list[this.goods_index].shipping_type) {
					for (let value_2 of value.shipping_list) {
						value_2.isShow = false;
					}
				}
				for (let value of this.goods_list[this.goods_index].shipping_type) {
					value.isShow = false;
				}
				this.goods_list[this.goods_index].index_shipping_type = this.pay_index;
				this.goods_list[this.goods_index].shipping_type[this.pay_index].isShow = true;
				this.goods_list[this.goods_index].pay_isShow = true;
			},

			// 配送点选择
			payShipping: function(t) {
				this.pay_index = this.goods_list[this.goods_index].index_shipping_type;
				this.goods_list[this.goods_index].shipping_type[this.pay_index].index_shipping_list = t;
				var index_shipping_list = this.goods_list[this.goods_index].shipping_type[this.pay_index]
					.index_shipping_list;
				for (let value of this.goods_list[this.goods_index].shipping_type) {
					for (let value_2 of value.shipping_list) {
						value_2.isShow = false;
					}
				}
				this.goods_list[this.goods_index].shipping_type[this.pay_index].shipping_list[index_shipping_list]
					.isShow = true;
				var id = this.goods_list[this.goods_index].shipping_type[this.pay_index].shipping_list[
					index_shipping_list].shipping_id;
				this.goods_list[this.goods_index].shipping_type_id = id;
				this.shipping_type_id = id; //用来存放选中的配送点id
				this.deliveryMethodText = this.goods_list[this.goods_index].shipping_type[this.pay_index]
					.shipping_list[index_shipping_list].shipping_name
			},

			// 商家自定配送时间
			merchantCustomizedTime: function(e) {
				if (e.detail.value.length != 0) {
					if (e.detail.value[0] == "商家自定") {
						this.best_time_isShow_1 = true; //商家自订
						this.best_time_isShow_2 = false; //客户自选
					} else {
						this.best_time_isShow_1 = false; //商家自订
						this.best_time_isShow_2 = false; //客户自选
					}
				} else {
					this.best_time_isShow_1 = false; //商家自订
					this.best_time_isShow_2 = false; //客户自选
				}
				this.best_time = ''; //配送时间
			},

			optionalDeliveryTime: function(e) {
				if (e.detail.value.length != 0) {
					if (e.detail.value[0] == "自选配送时间") {
						this.best_time_isShow_1 = false; //商家自订
						this.best_time_isShow_2 = true; //客户自选
					} else {
						this.best_time_isShow_1 = false; //商家自订
						this.best_time_isShow_2 = false; //客户自选
					}
				} else {
					this.best_time_isShow_1 = false; //商家自订
					this.best_time_isShow_2 = false; //客户自选
				}
				this.best_time = ''; //配送时间
			},

			// 配送时间选择
			dataRadioChange: function(e) {
				this.goods_list[this.goods_index].best_time = e.detail.value;
				this.best_time = e.detail.value;
			},

			// 订单留言
			inputPostscript: function(e) {
				this.goods_list[this.goods_index].postscript = e.detail.value;
			},

			// 提交订单 （立即购买）
			submitOrder: function() {
				var that = this;
				for (let value of that.goods_list) {
					if (that.is_pay_show == true) {
						that.isSubmit++
						if (that.isSubmit == 1) {
							if (that.product_list != undefined) {
								that.sub_order_now_bath_submit(value);
							} else {
								if(that.is_fx){
									//分销下单
									that.distributes_sub_order_submit(value)
								}else{
									that.sub_order_now_submit(value);
								}
								
							}
						} else {
							uni.showLoading({
								title: '正在提交订单'
							})
							setTimeout(() => {
								uni.hideLoading()
							}, 1500)
						}

					} else {
						// #ifdef MP-WEIXIN
						wx.showModal({
							content: '请选择支付方式',
							showCancel: false,
							confirmText: '关闭',
							success(res) {
								if (res.confirm) {
									console.log('用户点击确定')
								} else if (res.cancel) {
									console.log('用户点击取消')
								}
							}
						})
						// #endif
						// #ifndef MP-WEIXIN
						uni.showLoading({
							title: '请选择支付方式'
						});
						setTimeout(function() {
							uni.hideLoading();
						}, 1500);
						// #endif
					}
				}
			},
			
			//分销下单
			distributes_sub_order_submit(value){
				var that = this
				console.log(value)
				let params = {
					app_token: that.app_token,
					uos_id: that.uos_id,
					address_id: that.address_id,
					shipping_id: that.shipping_type_id,
					best_time: that.best_time,
					postscript: value.postscript,
					pay_type: that.pay_type,
					pay_id: that.pay_id,
					pay_name: that.pay_name,
					salesman: that.$Cache.get('PARENT_ID') || getApp().globalData.parent_id,
					goods_number: that.goods_number,
					froms: '微信小程序'
				}

				console.log('分销参数---------')
				console.log(params);
				
				distributes_sub_order_now(params).then((res2) => {
				
					if (res2.status != -2) {
				
						// 支付方式: 1平台支付宝2平台微信3商家支付宝4商家微信5商家网银7商家微信自动支付8商家支付宝自动支付
						if (res2.status != -1) {
				
							if (this.pay_type == 7) {
								// #ifdef MP-WEIXIN
								wx.login({
									success(res) {
										// 2、提取 code
										var code = res.code;
										// 商家自动支付
										third_epay_submit({
											out_trade_no: res2.data, //订单号
											title: '',
											type: 'wechat',
											method: 'miniapp',
											app_token: that.app_token,
											code: code,
										}).then((res3) => {
											uni.hideLoading()
											if (res3.status != -1) {
												var data = JSON.parse(res3.data);
												uni.requestPayment({
													provider: 'wxpay',
													timeStamp: data
														.timeStamp,
													nonceStr: data
														.nonceStr,
													package: data.package,
													signType: data
														.signType,
													paySign: data.paySign,
													success: function(
														res4) {
														uni.showModal({
															title: '提示',
															content: '微信支付成功',
															cancelText: '继续逛逛',
															confirmText: '查看订单',
															success: function(
																res
															) {
																if (res
																	.confirm
																) {
																	uni.redirectTo({
																		url: '/pages/order/order_list/index/index'
																	})
																} else if (
																	res
																	.cancel
																) {
																	uni.navigateBack()
																}
															},
														});
													},
													fail: function(err) {
														uni.redirectTo({
															url: '/pages/order/order_list/index/index?current=1'
														})
													}
												});
											} else {
												uni.showToast({
													title: res3.msg
												})
											}
										})
									}
								})
								// #endif
							}
						} else {
							uni.showModal({
								content: res2.msg,
								showCancel: false
							})
							this.isSubmit = 0
						}
					}
				}).catch(err => {
					this.isSubmit = 0
					uni.showToast({
						title: '请求失败',
						duration: 1500
					})
				})
		
			},

			sub_order_now_bath_submit(value) {
				let that = this;
				if (that.address_id == '' || that.address_id == 0) {
					that.isSubmit = 0;
					uni.showModal({
						title: '提示',
						content: '请添加地址',
						confirmText: '添加地址',
						success: function(res) {
							if (res.confirm) {
								uni.redirectTo({
									url: '/pages/users/user_address_list/index'
								})
							} else if (res.cancel) {
								return false;
							}
						},
					});
					return false;
				}
				uni.showLoading({
					title: '请求中...'
				})
				sub_order_now_bath({
					app_token: that.app_token,
					product_list: that.product_list,
					goods_id: that.goods_id,
					goods_number: that.goods_number,
					address_id: that.address_id,
					shipping_id: that.shipping_type_id,
					best_time: that.best_time,
					postscript: value.postscript,
					pay_type: that.pay_type,
					pay_id: that.pay_id,
					bonus_id: that.bonus_id, //红包id  bonus_id
					pay_name: that.pay_name,
					froms: '三宝物联小程序',
					salesman: that.$Cache.get('PARENT_ID') || getApp().globalData.parent_id,
				}).then((res2) => {
					console.log(res2)
					var that = this;
					if (res2.status != -1) {
						wx.login({
							success(res) {
								var code = res.code;
								// 商家微信支付
								third_epay_submit({
									out_trade_no: res2.data, //订单号
									title: '三宝物联小程序', //	可传商家名，也可留空
									type: 'wechat', //支付方式 支付宝：alipay 微信：wechat
									method: 'miniapp', //电脑支付：web 手机网页支付：wap app支付：app 扫码支付：scan 刷卡支付：pos 小程序支付:miniapp
									app_token: that.app_token,
									code: code //微信小程序需要·
								}).then((res3) => {
									console.log('打印独立小程序商家自动支付的平台微信支付')
									console.log(res3);
									var data = JSON.parse(res3.data);
									uni.requestPayment({
										provider: 'wxpay',
										timeStamp: data.timeStamp,
										nonceStr: data.nonceStr,
										package: data.package,
										signType: data.signType,
										paySign: data.paySign,
										success: function(res4) {
											uni.showModal({
												title: '提示',
												content: '微信支付成功',
												cancelText: '继续逛逛',
												confirmText: '查看订单',
												success: function(res) {
													uni.hideLoading()
													if (res.confirm) {
														uni.redirectTo({
															url: '/pages/order/order_list/index/index'
														})
													} else if (res
														.cancel) {
														uni.navigateBack({})
													}
												},
											});
										},
										fail: function(err) {
											uni.hideLoading()
											uni.navigateTo({
												url: '/pages/order/order_list/index/index?current=1'
											})
										}
									});

								})
							}
						})

					} else {
						uni.hideLoading()
						uni.showModal({
							content: res2.msg,
							showCancel: false
						})
						this.isSubmit = 0
					}

				}).catch(err => {
					uni.hideLoading()
					console.log('请求失败')
					console.log(err)
					uni.showToast({
						title: '请求失败'
					})
					this.isSubmit = 0
				})
			},

			sub_order_now_submit(value) {
				let that = this;
				if (that.address_id == '' || that.address_id == 0) {
					that.isSubmit = 0;
					uni.showModal({
						title: '提示',
						content: '请添加地址',
						confirmText: '添加地址',
						success: function(res) {
							if (res.confirm) {
								uni.redirectTo({
									url: '/pages/users/user_address_list/index'
								})
							} else if (res.cancel) {
								return false;
							}
						},
					});
					return false;
				}
				uni.showLoading({
					title: '请求中...'
				})
				sub_order_now({
					app_token: that.app_token,
					product_id: this.product_sn,
					goods_id: this.goods_id,
					goods_number: this.goods_number,
					address_id: this.address_id,
					shipping_id: this.shipping_type_id,
					best_time: this.best_time, //this.best_time
					postscript: value.postscript,
					pay_type: this.pay_type,
					pay_id: this.pay_id,
					bonus_id: this.bonus_id, //红包id  bonus_id
					pay_name: this.pay_name,
					froms: '三宝物联小程序',
					salesman: that.$Cache.get('PARENT_ID') || getApp().globalData.parent_id,
				}).then((res2) => {
					console.log(res2)
					var data_string = res2;
					// 支付方式: 1平台支付宝2平台微信3商家支付宝4商家微信5商家网银
					if (data_string.status != -1) {
						// 7商家微信自动支付8商家支付宝自动支付																				
						if (this.pay_type == 8) {
							// 支付平台：电脑支付：web 手机网页支付：wap app支付：app 扫码支付：scan 刷卡支付：pos
						} else if (this.pay_type == 7) {
							// #ifdef MP-WEIXIN
							wx.login({
								success(res) {
									var code = res.code;
									third_epay_submit({
										out_trade_no: data_string.data, //订单号
										title: '三宝物联小程序', //	可传商家名，也可留空
										type: 'wechat', //支付方式 支付宝：alipay 微信：wechat
										method: 'miniapp', //电脑支付：web 手机网页支付：wap app支付：app 扫码支付：scan 刷卡支付：pos 小程序支付:miniapp
										app_token: that.app_token,
										code: code //微信小程序需要·
									}).then((res3) => {
										console.log('打印独立小程序商家自动支付的平台微信支付')
										console.log(res3);
										var data = JSON.parse(res3.data);
										uni.requestPayment({
											provider: 'wxpay',
											timeStamp: data.timeStamp,
											nonceStr: data.nonceStr,
											package: data.package,
											signType: data.signType,
											paySign: data.paySign,
											success: function(res4) {
												uni.showModal({
													title: '提示',
													content: '微信支付成功',
													cancelText: '继续逛逛',
													confirmText: '查看订单',
													success: function(res) {
														uni.hideLoading()
														if (res.confirm) {
															uni.redirectTo({
																url: '/pages/order/order_list/index/index'
															})
														} else if (res
															.cancel) {
															uni.navigateBack({})
														}
													},
												});
											},
											fail: function(err) {
												uni.hideLoading()
												uni.navigateTo({
													url: '/pages/order/order_list/index/index?current=1'
												})
											}
										});

									})
								}
							})
							// #endif
						} else if (this.pay_type == 3) {
							// 通过订单号获取支付途径
							// get_pay_code({
							// 	order_sn: data_string.data,
							// 	app_token: that.app_token,
							// }).then((res3) => {
							// 	if (res3.status == 1) {
							// 		uni.redirectTo({
							// 			url: './payment/pay_by_img/index?pay_img=' +
							// 				res3.data.pay_img +
							// 				'&total_price=' + this
							// 				.total_price + '&supplier_name=' +
							// 				this.goods_list[0].supplier_name
							// 		})
							// 	} else {
							// 		uni.showModal({
							// 			content: res3.msg,
							// 			showCancel: false,
							// 			success: () => {
							// 				uni.redirectTo({
							// 					url: '/pages5/user_center/user_order/user_order'
							// 				})
							// 			}
							// 		})
							// 	}
							// }).catch(err => {
							// 	console.log(err)
							// })

						} else if (this.pay_type == 4) {

							// get_pay_code({
							// 	order_sn: data_string.data, //订单号
							// 	app_token: that.app_token,
							// }).then((res3) => {
							// 	if (res3.status == 1) {
							// 		uni.redirectTo({
							// 			url: '/pages-pay-type/pay_img_w/pay_img_w?pay_img=' +
							// 				res3.data.pay_img +
							// 				'&total_price=' + this
							// 				.total_price + '&supplier_name=' +
							// 				this.goods_list[0].supplier_name
							// 		})
							// 	} else {
							// 		uni.showModal({
							// 			content: res3.msg,
							// 			showCancel: false,
							// 			success: () => {
							// 				uni.redirectTo({
							// 					url: '/pages5/user_center/user_order/user_order'
							// 				})
							// 			}
							// 		})
							// 	}
							// }).catch(err => {
							// 	console.log(err)
							// })
						} else if (this.pay_type == 5) {
							// get_pay_code({
							// 	order_sn: data_string.data, //订单号
							// 	app_token: that.app_token,
							// }).then((res2) => {
							// 	if (res2.status == 1) {
							// 		uni.redirectTo({
							// 			url: '/pages-pay-type/pay_bank/pay_bank?account=' +
							// 				res2.data.bank_info.account +
							// 				'&account_number=' + res2.data
							// 				.bank_info.account_number +
							// 				'&bname=' + res2.data.bank_info
							// 				.bname + '&bname2=' + res2.data
							// 				.bank_info.bname2
							// 		})
							// 	} else {
							// 		uni.showModal({
							// 			content: res2.msg,
							// 			showCancel: false
							// 		})
							// 	}
							// }).catch(err => {
							// 	console.log(err)
							// })
						} else if (this.pay_type == 6) {
							// 6货到付款
							uni.redirectTo({
								url: '/pages5/user_center/user_order/user_order'
							})
						} else if (this.pay_type == 2) {
							// #ifdef MP-WEIXIN
							wx.login({
								success(res) {
									// 2、提取 code
									var code = res.code;
									// 平台微信支付
									epay_submit({
										out_trade_no: data_string.data, //订单号
										title: '',
										type: 'wechat',
										method: 'miniapp',
										app_token: that.app_token,
										code: code,
										market: getApp().globalData.market, //1机电平台2信息平台
									}).then((res3) => {
										console.log('平台微信支付 非batch')
										uni.hideLoading()
										var data = JSON.parse(res3.data);
										uni.requestPayment({
											provider: 'wxpay',
											timeStamp: data.timeStamp,
											nonceStr: data.nonceStr,
											package: data.package,
											signType: data.signType,
											paySign: data.paySign,
											success: function(res4) {
												console.log(res4)
												uni.showModal({
													title: '提示',
													content: '微信支付成功',
													cancelText: '继续逛逛',
													confirmText: '查看订单',
													success: function(res) {
														uni.hideLoading()
														if (res.confirm) {
															uni.redirectTo({
																url: '/pages/order/order_list/index/index'
															})
														} else if (res
															.cancel) {
															uni.navigateBack({})
														}
													},
												});
											},
											fail: function(err) {
												uni.hideLoading()
												uni.redirectTo({
													url: '/pages/order/order_list/index/index?current=1'
												})
											}
										});
									})
								}
							})
							// #endif
						}
					} else {
						uni.hideLoading()
						uni.showModal({
							content: data_string.msg,
							showCancel: false
						})
						this.isSubmit = 0
					}
				}).catch(err => {
					uni.hideLoading()
					console.log('请求失败')
					console.log(err)
					uni.showToast({
						title: '请求失败'
					})
					this.isSubmit = 0
				})
			}

		}

	}
</script>

<style lang="scss" scoped>
	.page-content {
		background-color: #EEEEEE;

		.goods-box {
			height: 100vh;
			padding-bottom: 100px;

			.address-box {
				background: linear-gradient(to bottom, $theme-color 0%, #f5f5f5 100%);
				padding-top: 10px;

				.address-info {
					width: 710rpx;
					margin: 0 auto;
					padding: 14px 15px;
					background-color: #fff;


					.addr-info-pcd {
						color: #929292;
					}

					.addr-info-detail {
						color: #000000;
					}

					.addr-info-connect {
						color: #929292;

						.addr-info-connect-name {
							color: #595959;
						}
					}

				}

				.line {
					width: 710rpx;
					margin: 0 auto;
					height: 3rpx;

					image {
						width: 100%;
						height: 100%;
						display: block;
					}
				}

			}

			.store-goods {
				padding: 20rpx 30rpx;
				margin-top: 10px;
				border-radius: 12rpx;

				.store-info {
					display: flex;
					align-items: center;

					.store-info-logo {
						width: 40rpx;
						height: 40rpx;
						margin-right: 20rpx;
					}

					.store-info-name {
						font-size: 28rpx;
						color: #000000;
						font-weight: 600;
						line-height: 1;
					}
				}

				.store-goods-list {
					display: flex;
					margin-top: 30rpx;

					.sto-goo-li-cover {
						flex: none;
						width: 200rpx;
						height: 200rpx;
						margin-right: 15rpx;
					}

					.sto-goo-li-info {
						flex: 1;
						min-width: 0;

						.sto-goo-li-info-top {
							display: flex;
							width: 100%;

							.sto-goo-li-info-name {
								flex: 1;
								font-size: 28rpx;
								white-space: nowrap;
								overflow: hidden;
								text-overflow: ellipsis;
							}

							.sto-goo-li-info-price {
								display: flex;
								flex-direction: column;
								flex: none;
								padding-left: 15rpx;

								.sto-goo-li-info-shop-price {
									text-align: right;
									font-size: 28rpx;
								}

								.sto-goo-li-info-market-price {
									text-align: right;
									flex: none;
									font-size: 24rpx;
									color: #959595;
									text-decoration: line-through;
								}
							}
						}

						.sto-goo-li-info-center {
							display: flex;
							width: 100%;
							color: #959595;
							font-size: 28rpx;

							.sto-goo-li-info-attr {
								flex: 1;
							}

							.sto-goo-li-info-number {
								text-align: right;
								flex: none;
								padding-left: 15rpx;
							}
						}

					}

				}

				.store-goods-item {
					display: flex;
					align-items: center;
					margin-top: 30rpx;

					.sto-goo-item-name {
						font-size: 28rpx;
						flex: none;
						font-weight: 600;
					}

					.sto-goo-item-content {
						display: flex;
						align-items: center;
						flex-direction: column;
						flex: 1;
						min-width: 0;
						padding: 0 20rpx;


						text {
							width: 100%;
							font-size: 26rpx;
							text-align: right;
							height: 35rpx;
							line-height: 35rpx;
							white-space: nowrap;
							overflow: hidden;
							text-overflow: ellipsis;
						}

						.content-null {
							color: #959595;
						}
					}

					.arrow-right-icon {
						flex: none;
					}
				}

			}

			.red-envelope {
				margin-top: 30rpx;
				display: flex;
				align-items: center;
				height: 100rpx;
				padding: 0 30rpx;
				border-radius: 12rpx;

				background-color: #FFFEFF;

				.red-envelope-icon {
					width: 40rpx;
					height: 40rpx;
					margin-right: 20rpx;
				}

				.red-envelope-text {
					flex: 1;
				}

				.arrow-right-icon {}
			}


			.goods {
				width: 100%;
				margin-top: 20rpx;
				margin-bottom: 20rpx;
				background-color: #FFFFFF;

				.title {
					width: 100%;
					height: 80rpx;
					line-height: 80rpx;
					padding-left: 70rpx;
					position: relative;

					.img {
						width: 45rpx;
						height: 45rpx;
						position: absolute;
						top: 10rpx;
						left: 12rpx;

						image {
							width: 45rpx;
							height: 45rpx;
							object-fit: cover;

						}
					}
				}

				.title2 {
					line-height: 40rpx;
					font-size: 24rpx;
					color: #CC0518;
					padding-left: 0rpx;
					padding: 0 20rpx;
				}

				.goods-item {
					width: 100%;
					margin-bottom: 5rpx;
					padding: 30rpx;
					padding-right: 10rpx;
					background-color: #F2F2F2;
					display: flex;

					.left {
						flex: 1;
						height: 200rpx;

						.img {
							width: 200rpx;
							height: 200rpx;
							margin: 0 auto;

							image {
								width: 200rpx;
								height: 200rpx;
								object-fit: cover;
							}
						}
					}

					.right {
						flex: 3;
						padding-right: 150rpx;
						padding-left: 20rpx;
						position: relative;

						.name {
							width: 100%;
							line-height: 50rpx;
							// 多行省略号
							text-overflow: -o-ellipsis-lastline;
							overflow: hidden;
							text-overflow: ellipsis;
							display: -webkit-box;
							-webkit-line-clamp: 2;
							-webkit-box-orient: vertical;
							overflow: hidden;
						}

						.modle {
							width: 100%;
							line-height: 50rpx;
							color: #AEAEAE;
						}

						.number {
							position: absolute;
							top: 0rpx;
							right: 10rpx;
							text-align: right;

							.price {
								line-height: 50rpx;
							}

							.old-price {
								line-height: 60rpx;
								color: #9C9C9C;
								text-decoration: line-through;
							}

							.number-number {
								line-height: 50rpx;
								color: #9C9C9C;
							}
						}
					}
				}

				.pay-methods {
					width: 100%;
					padding: 20rpx;

					.pay-title {
						width: 100%;
						height: 80rpx;
						line-height: 80rpx;
						padding-left: 50rpx;
						position: relative;
						border-bottom: 2rpx solid #DEDEDE;

						.img {
							width: 40rpx;
							height: 40rpx;
							position: absolute;
							top: 10rpx;
							left: 0;

							image {
								width: 40rpx;
								height: 40rpx;
								object-fit: cover;
							}
						}
					}
				}

				.pay-item {
					width: 100%;
					padding: 20rpx;
					padding-top: 30rpx;

					.txt {
						padding: 10rpx 20rpx;
						border: 2rpx solid #969696;
						display: inline-block;
						margin-top: 10rpx;
						margin-right: 30rpx;
						margin-bottom: 30rpx;
					}

					.txt-3 {
						padding: 10rpx 20rpx;
						border: none;
						display: inline-block;
						margin-top: 10rpx;
						margin-right: 30rpx;
						margin-bottom: 30rpx;
						color: #FFFFFF;
						background-color: #CC0518;
					}

					.item {
						width: 100%;
						padding-top: 10rpx;
						padding-bottom: 10rpx;

						.txt-2 {
							padding-left: 15rpx;
						}
					}
				}

				.s-time-box {
					width: 100%;
					padding: 20rpx;

					.s-time-title {
						width: 100%;
						height: 60rpx;
						padding-left: 60rpx;
						position: relative;

						image {
							width: 50rpx;
							height: 50rpx;
							object-fit: cover;
							position: absolute;
							top: 10;
							left: 0;
						}

						.img-3 {
							width: 40rpx;
							height: 40rpx;
							top: 10;
							left: 0;
						}

						.img-4 {
							position: absolute;
							top: 0;
							right: 0rpx;
						}
					}

					.s-time-title3 {
						width: 100%;
						height: 60rpx;
						padding-left: 60rpx;
						position: relative;

						.img-3 {
							width: 40rpx;
							height: 40rpx;
							position: absolute;
							top: 10;
							left: 0;
						}

						.img-4 {
							width: 60rpx;
							height: 60rpx;
							position: absolute;
							top: 0;
							right: 0rpx;
						}
					}

					.input {
						width: 100%;
						height: 80rpx;
						margin: 0 auto;
						padding-left: 20rpx;
						padding-right: 20rpx;
						border: 2rpx solid #DEDEDE;
					}
				}
			}

			.pay-type {
				margin-top: 30rpx;
				background-color: #FFFFFF;

				.title {
					padding: 10px 20px;
				}

				.radio-box {
					width: 100%;

					.radio-item {
						height: 80rpx;
						padding: 0 40rpx;
						display: flex;
					}
				}
			}

			.s-time-box-2 {
				padding: 30rpx;
			}
		}

		.footer {
			width: 100%;
			height: 100rpx;
			background-color: #fff;
			padding: 0 30rpx;
			font-size: 28rpx;
			color: #333;

			position: fixed;
			bottom: 0;
			left: 0;
			z-index: 9;

			.settlement {
				font-size: 30rpx;
				color: #fff;
				width: 240rpx;
				height: 70rpx;
				background-color: rgba(233, 51, 35, 1);
				border-radius: 50rpx;
				text-align: center;
				line-height: 70rpx;
			}
		}

		.select-address {
			.address-item {
				.item-box {
					padding: 30rpx;

					.ad-txt {
						text-align: right;
						color: #C60B1C;
					}
				}

			}
		}

		.red-content-box {
			background-color: #EEEEEE;

			.list_box {
				padding-top: 70rpx;
				width: 100%;

				.radio-box {
					margin-top: 40rpx;
					width: 100%;
					height: 50rpx;
					line-height: 50rpx;
				}

				.red-box {
					width: 100%;
					text-align: center;

					.red-list {
						width: 95%;
						margin: auto;

						.img-bg {
							width: 100%;
							height: 300rpx;
							border-radius: 20rpx;
							position: relative;
							margin-bottom: 20rpx;

							.img {
								width: 100%;
								height: 300rpx;
								border-radius: 20rpx;
							}

							.red-content {
								position: absolute;
								top: 0;
								left: 0;
								right: 0;
								bottom: 0;
								width: 100%;
								padding: 10rpx;
								display: flex;

								.left {
									flex: 1;

									.money {
										width: 100%;
										line-height: 80rpx;
										padding-top: 50rpx;
										color: #FFFFFF;
										text-align: center;

										.txt {
											font-size: 50rpx;
											padding-right: 10rpx;
											line-height: 80rpx;
										}
									}

									.title-m {
										width: 100%;
										text-align: center;
										font-size: 28rpx;
										color: #FFFFFF;
										line-height: 40rpx;
									}
								}

								.left2 {
									padding-top: 20rpx;
								}

								.right {
									flex: 2;
									padding-left: 20rpx;
									text-align: left;
									padding-top: 20rpx;

									.store-name {
										width: 100%;
										height: 100rpx;
										font-size: 30rpx;
										font-weight: bold;

										.txt {
											display: -webkit-box;
											line-height: 40rpx;
											word-break: break-all;
											-webkit-box-orient: vertical;
											-webkit-line-clamp: 2;
											overflow: hidden;
											text-overflow: ellipsis;
										}
									}

									.store-name2 {
										padding-top: 30rpx;
										height: 80rpx;

										.txt {
											line-height: 30rpx;
										}
									}

									.min-money {
										width: 100%;
										line-height: 60rpx;
										font-size: 26rpx;

										.txt {
											padding-right: 10rpx;
										}
									}

									.time-box {
										width: 100%;
										font-size: 26rpx;
										position: relative;

										.txt {
											padding-right: 10rpx;
										}

										.txt2 {
											position: absolute;
											bottom: 0rpx;
											right: 10rpx;
											padding: 8rpx 20rpx;
											background-color: #FF7A00;
											color: #FFFFFF;
											font-size: 24rpx;
											line-height: 30rpx;
											border-radius: 20rpx;
										}

										.txt3 {
											position: absolute;
											bottom: 0rpx;
											right: 30rpx;
											padding: 8rpx 20rpx;
											background-color: #000000;
											color: #FFFFFF;
											font-size: 24rpx;
											line-height: 30rpx;
											border-radius: 20rpx;
										}
									}
								}
							}
						}
					}
				}

				.box {
					.list {
						padding: 20upx;
						display: flex;
						flex-direction: row;
						padding-bottom: 30rpx;
						border-bottom: 1rpx solid #DEDEDE;

						.left {
							flex: 1;
							text-align: center;

							.img {
								margin: auto auto;

								image {
									width: 150upx;
									height: 150upx;
								}
							}
						}

						.right {
							flex: 2;
							padding-right: 50upx;
							position: relative;

							.name {
								padding-bottom: 10upx;
							}

							.article_number {
								padding-bottom: 10upx;
							}

							.icon {
								position: absolute;
								top: 20upx;
								right: 10upx;

								.img_1 {
									width: 35upx;
									height: 35upx;
									border: 2upx solid #969696;
									border-radiu: 5upx;
								}

								.img_2 {
									width: 35upx;
									height: 35upx;
									border: 2upx solid #C50A1D;
									border-radiu: 5upx;

									image {
										width: 35upx;
										height: 35upx;
									}
								}
							}
						}
					}

				}

				#preloader_1 {
					height: 40px;
					line-height: 40px;
					position: relative;
					text-align: center;
				}

				#preloader_1 span {
					width: 5px;
					height: 5px;
					margin: 0 1px;
					display: inline-block;
					vertical-align: middle;
					background: #9b59b6;
					animation: preloader_1 1.5s infinite ease-in-out;
				}

				#preloader_1 span:nth-child(2) {
					animation-delay: .2s;
				}

				#preloader_1 span:nth-child(3) {
					animation-delay: .4s;
				}

				#preloader_1 span:nth-child(4) {
					animation-delay: .6s;
				}

				#preloader_1 span:nth-child(5) {
					animation-delay: .8s;
				}

				@keyframes preloader_1 {
					0% {
						height: 5px;
						background: #9b59b6;
					}

					25% {
						height: 30px;
						background: #3498db;
					}

					50% {
						height: 5px;
						background: #9b59b6;
					}

					100% {
						height: 5px;
						background: #9b59b6;
					}
				}
			}

			.massage {
				padding-top: 20px;
				padding-bottom: 30px;
			}
		}


		.popup-content {
			display: flex;
			flex-direction: column;
			align-items: center;
			padding-bottom: 50rpx;
			overflow-y: auto;

			.popup-content-title {
				display: inline-block;
				width: 100%;
				line-height: 90rpx;
				color: #000000;
				font-size: 30rpx;
				font-weight: 600;
				text-align: center;
			}

			.popup-content-item {
				width: 690rpx;
				margin-bottom: 30rpx;

				.pop-con-item-title {
					display: inline-block;
					font-size: 28rpx;
					color: #333333;
					font-weight: 600;
					margin-bottom: 15rpx;
				}
			}

			.popup-content-hint {
				color: #A7A7A7;
				font-size: 22rpx;
				padding-bottom: 10px;
			}

			.popup-content-textarea {
				width: 690rpx;
				padding: 20rpx;
				border-radius: 16rpx;
				background-color: #F6F6F6;
			}

			.popup-content-confirm {
				width: 690rpx;
				height: 80rpx;
				line-height: 80rpx;
				text-align: center;
				color: #FFFFFF;
				border-radius: 80rpx;
				background-color: #C60B1C;
			}
		}

	}
</style>